home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / archivers / bimagequantize / bimagequantizer.txt < prev    next >
Text File  |  1999-06-14  |  11KB  |  264 lines

  1.  
  2. -----------------------------------------------------------------------------
  3.    BLOCK IMAGE QUANTIZER V1 - (C) 1999 NAVEED KHUGIANI / ALGOTECH SOFTWARE
  4. -----------------------------------------------------------------------------
  5.  
  6.  
  7. DISCLAIMER
  8. ----------
  9. This program does not include any warranty of any kind.  No responsibility
  10. will be taken for anything that may happen by the use of this program.  Use
  11. at your own risk.  
  12.  
  13.  
  14. INTRODUCTION
  15. ------------
  16. There are various methods of compressing image data, the most popular method
  17. hovewer is 'lossy' compression.  Images can take up a lot of disk space and
  18. the compressibility of these images (especially digitized images) is not too
  19. good.  'lossy' compression reduces or transforms the data before main
  20. compression making it very easy to give a better compression ratio.
  21. What is important hovewer is to reduce the data in the image without
  22. degrading the quality of the image too much and to make the compression /
  23. decompression routine run very fast even on a 68000 7mhz processor.
  24. This is the purpose of the 'BlockImageQuantizer' image compressor.
  25.  
  26.  
  27. WHAT EXACTLY DOES IT DO
  28. -----------------------
  29. This small utility compresses greyscale image data by analysing small blocks
  30. in the image and deciding whether to quantize the block or to leave it
  31. alone.  This is determined by the quantization parameter allowing the user
  32. to select the quantization level.  Finally the quantized and non quantized
  33. data are joined together.  This is only a semi compressor.  The data can
  34. even be compressed further by about 30% when using LZ based compression.
  35. Compressed images can be viewed or saved in one of 3 file formats with
  36. preimage smoothing to reduce the 'blockiness' of images with high
  37. quantization levels.
  38.  
  39.  
  40. SYSTEM REQUIREMENTS
  41. -------------------
  42. It should work on any Amiga system with any kickstart version and processor.
  43. It requires approximately 256k of ram while compressing/viewing or
  44. decompressing a file.  It has only been tested on a 2 meg chip A500+.  If
  45. there are any problems, dont hesitate to contact me with a description of
  46. the bug(s)??
  47.  
  48.  
  49. PROGRAM SYNTAX
  50. --------------
  51.  
  52. COMPRESSING AN IMAGE
  53.  
  54. BImageQuantizer -c <sourcefile> [destfile] [-l#] -q#
  55.  
  56. <sourcefile> is the name of the image data to compress.  Currently it can
  57. only be a uncompressed ILBM file (320x256 16 level linear greyscale)
  58. If the'-l#' parameter is used, Raw Planar or Chunky images can be processed
  59. by the program.
  60.  
  61. [destfile] is optional and is the name of the compressed file to create.  If
  62. this is not included.  The compressed data will have the same filename as
  63. the sourcefile with the added extension .BIQ
  64.  
  65. -l# is the load format parameter and is followed by a number...
  66.                             -l1  : Load Raw Planar Image (40960 bytes)
  67.                             -l2  : Load Chunky image (81920 bytes)
  68. This parameter must be used if the data is a RAW file.
  69.  
  70. -q# is the quantization parameter.  The quantization number can be anything
  71. from 1 to 99.  (eg. -q18)
  72.  
  73.  
  74. DECOMPRESSING AN IMAGE
  75.  
  76. BImageQuantizer -d <sourcefile> <destfile> -s# -h
  77.  
  78. <sourcefile> is the name of the compressed image.  It must be a valid BIQ
  79. compressed file.
  80.  
  81. <destfile> is the name of the decompressed image file to create.
  82.  
  83. -s# is the save format.
  84.                         -s1   : Save as IFF ILBM (Uncompressed)
  85.                         -s2   : Save as Raw Planar (40960 bytes)
  86.                         -s3   : Save as Chunky (81920 bytes)
  87.  
  88. -h  This parameter is optional, but interpolates the image before saving it.
  89. It should only be used if the compressed image was quantized very heavily
  90.  
  91.  
  92. FOR VIEWING
  93.  
  94. BImageQuantizer -v <sourcefile> -h
  95.  
  96. <sourcefile> is the name of the compressed BIQ file.
  97. -h  is optional, but interpolates the image before displaying it.  Yet
  98. again, it should only be used if the compressed image was quantized heavily.
  99.  
  100.  
  101. IMPORTANT NOTE : It seems that this program can only accept a very limited
  102. range of IFF ILBM files.  I have no documentation on the IFF ILBM format and
  103. I did not want this program to rely on any other External libraries for its
  104. function.  for this reason, this program can only accept IFF ILBM files
  105. saved by the 'VidiGrab' FrameGrabber software (Supplied with the VidiAmiga
  106. digitizer.)
  107. IFF Files should be converted to Either RAW Planar or RAW Chunky using other
  108. utilities such as PicCon or GFXMaster.  These files can then be used by this
  109. compressor along with the load parameter.
  110.  
  111.  
  112. LIMITATIONS
  113. -----------
  114. This compressor can ONLY work on greyscale images in 16 shades with a linear
  115. palette (Colour 0 must start from black and gradually increase to white)
  116. The size of the image must also be 320x256
  117. These Limitations can easily be overcome, But I want to see the response
  118. from this program before I decide to create another version.
  119.  
  120.  
  121. HINTS AND TIPS
  122. --------------
  123.  
  124. CONVERTING AN IMAGE FOR THE BIMAGEQUANTIZER
  125.  
  126. As stated before.  There are a lot of restrictions on the IFF ILBM load
  127. format used by this program.  It is advisable to convert the image to either
  128. raw planar or raw chunky for use with this program
  129.  
  130. If the image is using different colours and/or a different size...
  131.       A: Convert the image to 16 shade greyscale using a suitable
  132.          art package/image processor
  133.       B: Remap the colours to a linear greyscale palette starting from
  134.          black and gradually increasing to white if it is not already done.
  135.       C: Crop or scale the size to 320x256 and save the image
  136.       D: Use a Raw image converter (Such as GFXMaster) to convert the image
  137.          to either Planar or Chunky (The palette is not important anymore)
  138.          The converted Planar filesize has to be exactly 40960 bytes and the
  139.          converted Chunky filesize has to be exactly 81920 bytes.
  140.       E: This file can now be used with this compressor by using the '-l'
  141.          parameter followed by a number
  142.  
  143. * Smoothing an image before compression can increase the compression ratio
  144.   of a compressed file at the expense of some blurring.
  145.  
  146. * Images with large single colour area's or smooth intensity changes spread
  147.   over large sections of the image can increase the compression ratio
  148.   dramatically
  149.  
  150. * The Amount of data quantized depends on the nature of the Image.  Some
  151.   images give little degradation in quality even when using high quantize
  152.   values while others can give very large degradation even when using low
  153.   quantization values.  Experimentation is required with the quantization
  154.   values.
  155.  
  156. * This compressor should ONLY be used on complex digitized images.  (It was
  157.   originally intended to be used in conjuction with the VidiAmiga digitizer)
  158.  
  159. * Avoid compressing images which feature text.  This compressor will in most
  160.   cases avoid quantizing anything with high intensity changes (eg: bright
  161.   text on average/dark digitized background) reducing the compression ratio
  162.   dramatically.
  163.  
  164. * The Image should have good dynamic range.  Attempting to compress Dull
  165.   images or images with too much contrast can reduce compression ratio or
  166.   increase quantization levels.
  167.  
  168.  
  169. EXAMPLES
  170. --------
  171.  
  172. Compressing A Raw Planar file called 'testpic.raw' to comppic.biq with a
  173. quantization value of 20
  174.                      BImageQuantizer -c testpic.raw comppic.biq -l1 -q20
  175.  
  176. Decompressing a BIQ File called comppic.biq to an IFF ILBM file called
  177. 'test.iff' with interpolation
  178.                      BImageQuantizer -d comppic.biq test.iff -s1 -h
  179.  
  180. Viewing a BIQ File called comppic.biq with no interpolation
  181.                      BImageQuantizer -v comppic.biq
  182.  
  183. This archive contains 3 image files.
  184.  
  185. TestImage.iff : This is the original IFF image with no degradation
  186. TestImage.raw : Same as Above, but in RAW Planar format.  Use this for
  187.                 experimenting.
  188. TestImage.biq : A compressed BIQ file of the above image with a quantisation
  189.                 level of 16.
  190.  
  191.  
  192. FILE SIZES
  193. ----------
  194. Some examples on the compressed file sizes achieved with this program.
  195.  
  196. FILENAME       COMPRESSED SIZE      ADDITIONAL COMPRESSION  QUANTIZATION
  197.  
  198. WomanFaceAdvert           8436                        6894            16
  199. LiveSatWomanPic           9262                        7344            20
  200.  
  201. All Files would have normally took up 40k as an IFF ILBM file and even with
  202. compression it would probably be in the region of 27k-28k
  203. Furthermore when using decent quantization values, Only the less important
  204. image sections get quantized leaving the important sections alone.
  205.  
  206.  
  207. TECHNICAL
  208. ---------
  209. This program performs quantization according to the contents of the current
  210. block it is analysing.  The analyser 'looks' at the complexity of this block
  211. and decides whether to quantize it to 1 colour value or to leave it alone.
  212. This is determined by the quantization value given in the program parameter.
  213. Normally once an image has been quantized and compressed, Most image
  214. sections with less complex data or smooth intensity changes will be
  215. quantized to 1 block value.  The compression is very basic.  While the data
  216. is being analysed and quantized, the Non quantized and quantized data are
  217. nybble merged and transferred to a buffer with a seperate flagbuffer being
  218. created for the decompressor.
  219. The great advantage in this is that the data can be compressed even further.
  220. (eg: a 10k compressed file can be compressed to around 7k)
  221. This program has been specifically developed to run on a 68000 processor.
  222. It is written in 100 percent assembly, less than 10k in size + compresses
  223. and decompresses an image in seconds on a 68000 7Mhz processor.
  224. The compression and decompression speeds can be improved dramatically by
  225. using a different method of writing and reading compressed data.  Currently
  226. it compresses data 1 bit at a time...
  227.  
  228.  
  229. THIS PROGRAM IS FREEWARE
  230. ------------------------
  231. This program is entirely freeware, Enjoy using the program and feel free to
  232. send me some comments.  I can be contacted at:
  233.  
  234. EMAIL
  235.  
  236. naveedkhugiani@students.elatt.org.uk
  237.               (Note: Only until 24th july 1999)
  238.  
  239. SNAILMAIL
  240.  
  241. Naveed Khugiani,
  242. 12 Huntshaw House,
  243. Devons road,
  244. Bow,
  245. London,
  246. E3, 3NR
  247.  
  248.  
  249. OTHER RELEASED PROGRAMS
  250. -----------------------
  251. All the below programs are available from the Amiga Internet archive
  252. 'AMINET'
  253.  
  254. BWToGrey : This small utility will convert a black and white image to full
  255.            greyscale in seconds with additional preview and various save
  256.            formats.
  257.  
  258. BRLECompressor : Another Image compressor which compresses greyscale image
  259.                  data in seconds with no loss in quality and a better
  260.                  compression ratio than most compressors.
  261.                  Can be used as a slideshow viewer enabling the user to fit
  262.                  dozens of greyscale images on 1 disk.
  263.  
  264.